home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 July
/
EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso
/
earcd
/
demo
/
mag
/
trash3_2.lha
/
fuentes
/
TEXTURE-FUENTES.lha
/
tunnel9.s
< prev
next >
Wrap
Text File
|
1996-09-21
|
5KB
|
277 lines
;=========================================================
;
; This chunky2planar routine was made by Ludde/Encore.
;
; You may uses it for whatever you want, but if you do
; it would be nice if you gave me credits if you release
; anything! :)
;
; Send bug-reports, comments, optimise-tips, etc to:
;
; e-mail: ludvigp@ifi.uio.no
;
;==========================================================
IFD _PHXASS_
MACHINE 68030
ENDIF
include "Startup_macros.i"
include "custom.i"
;------------------ Startup Options ------------------------
KillSystem = 1
SaveInterrupts = 1
NewCopperList = 1
ScreenWidth = 320
ScreenHeight = 128
Bitplanes = 8
ScreenSize = ScreenWidth*ScreenHeight
BitplaneSize = ScreenSize/8
;-----------------------------------------------------------
ChunkyWidth = 160
ChunkyHeight = 128
ChunkyPixels = ChunkyWidth*ChunkyHeight
;ClearChunkyBuffer
Section MainProgram,code
j:
SaveSystem
ClrINT ALL
ClrINTQ ALL
ClrDMA ALL
jsr SetupCopperList
;---------
bsr _texture
;---------
move.l VectorBase,a0
move.l #Lev3InterruptHandler,$6c(a0)
SetDMA DMAF_MASTER!DMAF_RASTER!DMAF_COPPER!DMAF_BLITTER!DMAF_SPRITE
SetINT INTF_INTEN!INTF_VERTB
MainLoop:
RastPos s_Render_time
bsr Render
RastPos e_Render_time
;Different routines:
jsr c2p_2_Pass ;1 cpu pass = c2p_1_pass
;2 cpu passes = c2p_2_pass
WaitMouse MLeft,MainLoop
RestoreSystem
move.w e_Render_time(pc),d0
sub.w s_Render_time(pc),d0 ;Cpu c2p rastertime
moveq #0,d1
move.w e_c2p_time(pc),d1
sub.w s_c2p_time(pc),d1 ;Cpu c2p rastertime
move.l TellFrames,d7
muls.l #50,d7
divs.l TellTicks,d7 ;Average Frame Rate
rts
s_c2p_time: dc.w 0
e_c2p_time: dc.w 0
s_Render_time: dc.w 0
e_Render_time: dc.w 0
;-----------------------------------------------------RENDER
Render:
; Here YOU do your stuff! :)
tunel1:
moveq #0,d1 ; x adder
tunnel: ;bsr startq
mouse: ;bsr waitline
;---
; Texture tunnel code...
;---
movem.l d0-a6,-(sp)
lea X,A1 ; X table
lea Y,A2 ; Y table
lea Texture,A3 ; Texture
lea ChunkyBuffer+14*160,A4 ; Buffer
moveq #0,D6
moveq #0,D2
moveq #0,D3
moveq #0,D4 ; Delta value...
move.w deltax,d5
move.w deltay,d1
move.w #99,D7 ; Y loop
do_y move.w #159,D6 ; X loop
do_x move.b (A1)+,D2 ; X value...
add.b D5,D2 ; X add
move.b (A2)+,D3 ; Y value...
add.b D1,D3
lsl.w #8,D3
add.w D2,D3 ; (X + Y*256)
move.b (A3,D3.l),(A4)+
dbf D6,do_x
; addq.w #1,d1 ; <----------------
; add.b #1,D5
dbf D7,do_y
addq.w #2,deltay ; Delta Y
addq.w #2,deltax ; Delta X
movem.l (sp)+,d0-a6
rts
X incbin x.bin
Y incbin y.bin
Texture blk.b 256*256,0
Secure blk.b 512,0
deltax dc.w 0
deltay dc.w 0
;-------------------------------
_texture
bsr InitRND
lea RNDSeed,a1
lea Texture,a2
move #$FFFF,d7
do_texture
moveq #0,d0
moveq #32,d1
bsr RND
move.b d0,(a2)+
dbf d7,do_texture
move.w #255,d7
lea Secure,a2
extra_txt
moveq #0,d0
moveq #32,d1
bsr RND
move.b d0,(a2)+
dbf d7,extra_txt
; rts
;-------------
inter2 moveq #10,d6
inter21
lea Texture,a1
lea Texture+256,a2
lea Texture+1,a3
lea Texture+2,a4
lea Texture,a5
move #$FFFF,d7
interpol
moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d3
move.b (a1)+,d0
move.b (a2)+,d1
move.b (a3)+,d2
move.b (a4)+,d3
add d0,d1
add d2,d3
add d1,d3
lsr.w #2,d3
move.b d3,(a5)+
dbf d7,interpol
dbf d6,inter21
RTS
* D0,D1 - A1
* In : D1 Numero maximo
* Out : D0 Numero entre 1 y D1
RND LEA RNDSeed,A1 ; D0 = Numero entre 1 y D1
MOVE.L (A1),D0
ADD.L D0,D0
BHI.s .OVER
EORI.L #$1D872B41,D0
.OVER MOVE.L D0,(A1)
ANDI.L #$FFFF,D0
DIVU D1,D0
SWAP D0
RTS
InitRND LEA RNDSeed,A0
MOVE.L $DFF006,D0
NEG.W D0
MOVE.L D0,(A0)
rts
RNDSeed dc.l 0
;-----------------------------------------------------
Section ChunkyStuff,bss
ChunkyBuffer:
blk.b ChunkyPixels
ChunkyEnd:
;Texture ds.b 256*256
;-----------------------------------------------------------------------------
include "Blitter_c2p.i"
include "Startup_code.i"